

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>osdmaptool – ceph osd 运行图操作工具 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="rados – rados 对象存储工具" href="../rados/" />
    <link rel="prev" title="monmaptool – ceph 监视器运行图操作工具" href="../monmaptool/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../../rados/">Ceph 存储集群</a> &raquo;</li>
        
          <li><a href="../../../rados/man/">对象存储手册页</a> &raquo;</li>
        
      <li>osdmaptool – ceph osd 运行图操作工具</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/man/8/osdmaptool.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../../rados/configuration/">配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../rados/operations/">运维</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../../rados/man/">    手册页</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../ceph-volume/">ceph-volume – Ceph OSD 部署和检查工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-volume-systemd/">ceph-volume-systemd – systemd ceph-volume 辅助工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph/">ceph – Ceph 管理工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-authtool/">ceph-authtool – ceph 密钥环操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-clsinfo/">ceph-clsinfo – 查看类对象信息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-conf/">ceph-conf – ceph 配置文件工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-debugpack/">ceph-debugpack – ceph 调试信息打包工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-dencoder/">ceph-dencoder – ceph 编码器/解码器工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-mon/">ceph-mon – ceph 监视器守护进程</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-osd/">ceph-osd – ceph 对象存储守护进程</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-kvstore-tool/">ceph-kvstore-tool – ceph 的 kvstore 操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-run/">ceph-run – 发生核心转储后重启守护进程</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-syn/">ceph-syn – ceph 的人造负载生成器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crushdiff/">crushdiff – ceph crush 图测试工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crushtool/">crushtool – CRUSH 图操作工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../librados-config/">librados-config – 显示关于 librados 的信息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monmaptool/">monmaptool – ceph 监视器运行图操作工具</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">osdmaptool – ceph osd 运行图操作工具</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">提纲</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">描述</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">选项</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">实例</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">使用范围</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id6">参考</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../rados/">rados – rados 对象存储工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-post-file/">ceph-post-file – 把文件上传给 ceph 开发者</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../rados/troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../rados/api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="osdmaptool-ceph-osd">
<span id="osdmaptool"></span><h1>osdmaptool – ceph osd 运行图操作工具<a class="headerlink" href="#osdmaptool-ceph-osd" title="Permalink to this headline">¶</a></h1>
<div class="section" id="id1">
<h2>提纲<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<div class="line-block">
<div class="line"><strong>osdmaptool</strong> <em>mapfilename</em> [–print] [–createsimple <em>numosd</em>
[–pgbits <em>bitsperosd</em> ] ] [–clobber]</div>
<div class="line"><strong>osdmaptool</strong> <em>mapfilename</em> [–import-crush <em>crushmap</em>]</div>
<div class="line"><strong>osdmaptool</strong> <em>mapfilename</em> [–export-crush <em>crushmap</em>]</div>
<div class="line"><strong>osdmaptool</strong> <em>mapfilename</em> [–upmap <em>file</em>] [–upmap-max <em>max-optimizations</em>]
[–upmap-deviation <em>max-deviation</em>] [–upmap-pool <em>poolname</em>]
[–save] [–upmap-active]</div>
<div class="line"><strong>osdmaptool</strong> <em>mapfilename</em> [–upmap-cleanup] [–upmap <em>file</em>]</div>
</div>
</div>
<div class="section" id="id2">
<h2>描述<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p><strong>osdmaptool</strong> 工具可用于创建、查看、修改 Ceph 分布式存储系统的 OSD 集群运行图。很显然，它可用于提取内嵌的 CRUSH 图，或者导入新 CRUSH 图。它也能模拟 upmap 均衡器模式，这样你就能切身感受到，要均衡 PG 还需要什么。</p>
</div>
<div class="section" id="id3">
<h2>选项<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<dl class="std option">
<dt id="cmdoption-osdmaptool-print">
<code class="sig-name descname"><span class="pre">--print</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-print" title="Permalink to this definition">¶</a></dt>
<dd><p>修改完成后，打印此运行图的一份纯文本转储。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-dump">
<code class="sig-name descname"><span class="pre">--dump</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;format&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-dump" title="Permalink to this definition">¶</a></dt>
<dd><p>&lt;format&gt; 为 plain 时以纯文本方式显示运行图，
若不支持指定格式就默认为 json 。
这是 print 选项的替代品。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-clobber">
<code class="sig-name descname"><span class="pre">--clobber</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-clobber" title="Permalink to this definition">¶</a></dt>
<dd><p>修改时允许 osdmaptool 覆盖 mapfilename 。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-import-crush">
<code class="sig-name descname"><span class="pre">--import-crush</span></code><code class="sig-prename descclassname"> <span class="pre">mapfile</span></code><a class="headerlink" href="#cmdoption-osdmaptool-import-crush" title="Permalink to this definition">¶</a></dt>
<dd><p>从 mapfile 载入 CRUSH 图并把它嵌入 OSD 图。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-export-crush">
<code class="sig-name descname"><span class="pre">--export-crush</span></code><code class="sig-prename descclassname"> <span class="pre">mapfile</span></code><a class="headerlink" href="#cmdoption-osdmaptool-export-crush" title="Permalink to this definition">¶</a></dt>
<dd><p>从 OSD 图提取出 CRUSH 图并写入 mapfile 。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-createsimple">
<code class="sig-name descname"><span class="pre">--createsimple</span></code><code class="sig-prename descclassname"> <span class="pre">numosd</span> <span class="pre">[--pg-bits</span> <span class="pre">bitsperosd]</span> <span class="pre">[--pgp-bits</span> <span class="pre">bits]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-createsimple" title="Permalink to this definition">¶</a></dt>
<dd><p>创建有 numosd 个设备的相对通用的 OSD 图。
若指定了 –pg-bits 选项，每个 OSD 的归置组数量将是 bitsperosd 个位偏移。
也就是 pg_num 属性将被设置为 numosd 数值再右移 bitsperosd 位。
若指定了 –pgp-bits 选项，
pgp_num 属性将被设置为 numosd 数值再右移 bits 位。</p>
<p>&lt;译者注&gt;: pgp_num map attribute: 意为 osd map 之中的 pgp_num 属性</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-create-from-conf">
<code class="sig-name descname"><span class="pre">--create-from-conf</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-create-from-conf" title="Permalink to this definition">¶</a></dt>
<dd><p>按默认配置创建一份 OSD 图。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-map-pgs">
<code class="sig-name descname"><span class="pre">--test-map-pgs</span></code><code class="sig-prename descclassname"> <span class="pre">[--pool</span> <span class="pre">poolid]</span> <span class="pre">[--range-first</span> <span class="pre">&lt;first&gt;</span> <span class="pre">--range-last</span> <span class="pre">&lt;last&gt;]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-test-map-pgs" title="Permalink to this definition">¶</a></dt>
<dd><p>打印出归置组到 OSD 的映射关系。
如果指定了范围，那它就依次递归
osdmaptool 参数所指目录内 first 到 last 之间的。
例如： <strong>osdmaptool –test-map-pgs –range-first 0 –range-last 2 osdmap_dir</strong>.
它会递归 osdmap_dir 内名为 0 、 1 、 2 的文件。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-map-pgs-dump">
<code class="sig-name descname"><span class="pre">--test-map-pgs-dump</span></code><code class="sig-prename descclassname"> <span class="pre">[--pool</span> <span class="pre">poolid]</span> <span class="pre">[--range-first</span> <span class="pre">&lt;first&gt;</span> <span class="pre">--range-last</span> <span class="pre">&lt;last&gt;]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-test-map-pgs-dump" title="Permalink to this definition">¶</a></dt>
<dd><p>打印出所有归置组及其与 OSD 映射关系的汇总。如果指定了范围，那它就依次递归 osdmaptool 参数所指目录内 first 到 last 之间的。
例如： <strong>osdmaptool –test-map-pgs-dump –range-first 0 –range-last 2 osdmap_dir</strong>.
它会递归 osdmap_dir 内名为 0 、 1 、 2 的文件。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-map-pgs-dump-all">
<code class="sig-name descname"><span class="pre">--test-map-pgs-dump-all</span></code><code class="sig-prename descclassname"> <span class="pre">[--pool</span> <span class="pre">poolid]</span> <span class="pre">[--range-first</span> <span class="pre">&lt;first&gt;</span> <span class="pre">--range-last</span> <span class="pre">&lt;last&gt;]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-test-map-pgs-dump-all" title="Permalink to this definition">¶</a></dt>
<dd><p>会打印出所有归置组及其到所有 OSD 映射关系的汇总。
如果指定了范围， osdmaptool 会根据参数指定的目录从头到尾挨个迭代。
例如： <strong>osdmaptool –test-map-pgs-dump-all –range-first 0 –range-last 2 osdmap_dir</strong> ，
此命令会迭代 osdmap_dir 里名为 0,1,2 的文件们。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-random">
<code class="sig-name descname"><span class="pre">--test-random</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-test-random" title="Permalink to this definition">¶</a></dt>
<dd><p>把归置组随机地映射到各个 OSD 。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-map-pg">
<code class="sig-name descname"><span class="pre">--test-map-pg</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;pgid&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-test-map-pg" title="Permalink to this definition">¶</a></dt>
<dd><p>把某个特定的归置组（用 pgid 指定的）映射到多个 OSD 。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-map-object">
<code class="sig-name descname"><span class="pre">--test-map-object</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;objectname&gt;</span> <span class="pre">[--pool</span> <span class="pre">&lt;poolid&gt;]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-test-map-object" title="Permalink to this definition">¶</a></dt>
<dd><p>把某个特定的归置组（由对象名 objectname 确定）映射到一组 OSD 。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-test-crush">
<code class="sig-name descname"><span class="pre">--test-crush</span></code><code class="sig-prename descclassname"> <span class="pre">[--range-first</span> <span class="pre">&lt;first&gt;</span> <span class="pre">--range-last</span> <span class="pre">&lt;last&gt;]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-test-crush" title="Permalink to this definition">¶</a></dt>
<dd><p>把各归置组映射到正常工作的 OSD 们。
如果指定了范围，根据 osdmaptool 参数里指定的、
从目录里的第一个到最后一个挨个迭代。
例如： <strong>osdmaptool –test-crush –range-first 0 –range-last 2 osdmap_dir</strong>.
此命令会迭代 osdmap_dir 里名为 0,1,2 的文件。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-mark-up-in">
<code class="sig-name descname"><span class="pre">--mark-up-in</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-mark-up-in" title="Permalink to this definition">¶</a></dt>
<dd><p>把 OSD 们标记为 up 且 in （但不持久化）。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-mark-out">
<code class="sig-name descname"><span class="pre">--mark-out</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-mark-out" title="Permalink to this definition">¶</a></dt>
<dd><p>把 OSD 们标记为 out （但不持久化）。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-mark-up">
<code class="sig-name descname"><span class="pre">--mark-up</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;osdid&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-mark-up" title="Permalink to this definition">¶</a></dt>
<dd><p>把 OSD 们标记为 up （但不持久化）。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-mark-in">
<code class="sig-name descname"><span class="pre">--mark-in</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;osdid&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-mark-in" title="Permalink to this definition">¶</a></dt>
<dd><p>把 OSD 们标记为 in （但不持久化）。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-tree">
<code class="sig-name descname"><span class="pre">--tree</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-tree" title="Permalink to this definition">¶</a></dt>
<dd><p>按分级树显示此运行图。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-clear-temp">
<code class="sig-name descname"><span class="pre">--clear-temp</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-clear-temp" title="Permalink to this definition">¶</a></dt>
<dd><p>清空 pg_temp 和 primary_temp 变量。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-clean-temps">
<code class="sig-name descname"><span class="pre">--clean-temps</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-clean-temps" title="Permalink to this definition">¶</a></dt>
<dd><p>清空 pg_temps 。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-health">
<code class="sig-name descname"><span class="pre">--health</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-health" title="Permalink to this definition">¶</a></dt>
<dd><p>转储出健康检查信息。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-with-default-pool">
<code class="sig-name descname"><span class="pre">--with-default-pool</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-with-default-pool" title="Permalink to this definition">¶</a></dt>
<dd><p>创建运行图时包含默认的存储池。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-upmap-cleanup">
<code class="sig-name descname"><span class="pre">--upmap-cleanup</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;file&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-upmap-cleanup" title="Permalink to this definition">¶</a></dt>
<dd><p>清理 pg_upmap[_items] 条目，把命令写入 &lt;file&gt; [默认: - 表示写入 stdout]</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-upmap">
<code class="sig-name descname"><span class="pre">--upmap</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;file&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-upmap" title="Permalink to this definition">¶</a></dt>
<dd><p>计算 pg upmap 条目，以均衡 pg 布局，把命令写入 &lt;file&gt; [默认: - 表示写入 stdout]</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-upmap-max">
<code class="sig-name descname"><span class="pre">--upmap-max</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;max-optimizations&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-upmap-max" title="Permalink to this definition">¶</a></dt>
<dd><p>设置要计算的最大 upmap 条目数 [默认: 10]</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-upmap-deviation">
<code class="sig-name descname"><span class="pre">--upmap-deviation</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;max-deviation&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-upmap-deviation" title="Permalink to this definition">¶</a></dt>
<dd><p>与目标的最大偏差 [默认: 5]</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-upmap-pool">
<code class="sig-name descname"><span class="pre">--upmap-pool</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;poolname&gt;</span></code><a class="headerlink" href="#cmdoption-osdmaptool-upmap-pool" title="Permalink to this definition">¶</a></dt>
<dd><p>把 upmap 均衡限制在指定存储池之内，此选项可以重用多次以指定多个存储池。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-upmap-active">
<code class="sig-name descname"><span class="pre">--upmap-active</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-upmap-active" title="Permalink to this definition">¶</a></dt>
<dd><p>像一个活跃的均衡器一样运行，不停地应用变更直到均衡完成。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-adjust-crush-weight">
<code class="sig-name descname"><span class="pre">--adjust-crush-weight</span></code><code class="sig-prename descclassname"> <span class="pre">&lt;osdid:weight&gt;[,&lt;osdid:weight&gt;,&lt;...&gt;]</span></code><a class="headerlink" href="#cmdoption-osdmaptool-adjust-crush-weight" title="Permalink to this definition">¶</a></dt>
<dd><p>更改 &lt;osdid&gt; 的 CRUSH 权重。</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-osdmaptool-save">
<code class="sig-name descname"><span class="pre">--save</span></code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-osdmaptool-save" title="Permalink to this definition">¶</a></dt>
<dd><p>写入更改过（ upmap 或调整了 crush ）的 osdmap</p>
</dd></dl>

</div>
<div class="section" id="id4">
<h2>实例<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2>
<p>要创建个有 16 个设备的简易图：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">osdmaptool</span> <span class="o">--</span><span class="n">createsimple</span> <span class="mi">16</span> <span class="n">osdmap</span> <span class="o">--</span><span class="n">clobber</span>
</pre></div>
</div>
<p>查看结果：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">osdmaptool</span> <span class="o">--</span><span class="nb">print</span> <span class="n">osdmap</span>
</pre></div>
</div>
<p>要查看存储池 1 的归置组映射情况：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">osdmaptool</span> <span class="o">--</span><span class="n">test</span><span class="o">-</span><span class="nb">map</span><span class="o">-</span><span class="n">pgs</span><span class="o">-</span><span class="n">dump</span> <span class="n">rbd</span> <span class="o">--</span><span class="n">pool</span> <span class="mi">1</span>

<span class="n">pool</span> <span class="mi">1</span> <span class="n">pg_num</span> <span class="mi">8</span>
<span class="mf">1.0</span>     <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> <span class="mi">0</span>
<span class="mf">1.1</span>     <span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> <span class="mi">2</span>
<span class="mf">1.2</span>     <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span> <span class="mi">0</span>
<span class="mf">1.3</span>     <span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> <span class="mi">2</span>
<span class="mf">1.4</span>     <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> <span class="mi">0</span>
<span class="mf">1.5</span>     <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> <span class="mi">0</span>
<span class="mf">1.6</span>     <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span> <span class="mi">0</span>
<span class="mf">1.7</span>     <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span> <span class="mi">1</span>
<span class="c1">#osd    count   first   primary c wt    wt</span>
<span class="n">osd</span><span class="mf">.0</span>   <span class="mi">8</span>       <span class="mi">5</span>       <span class="mi">5</span>       <span class="mi">1</span>       <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.1</span>   <span class="mi">8</span>       <span class="mi">1</span>       <span class="mi">1</span>       <span class="mi">1</span>       <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.2</span>   <span class="mi">8</span>       <span class="mi">2</span>       <span class="mi">2</span>       <span class="mi">1</span>       <span class="mi">1</span>
 <span class="ow">in</span> <span class="mi">3</span>
 <span class="n">avg</span> <span class="mi">8</span> <span class="n">stddev</span> <span class="mi">0</span> <span class="p">(</span><span class="mi">0</span><span class="n">x</span><span class="p">)</span> <span class="p">(</span><span class="n">expected</span> <span class="mf">2.3094</span> <span class="mf">0.288675</span><span class="n">x</span><span class="p">))</span>
 <span class="nb">min</span> <span class="n">osd</span><span class="mf">.0</span> <span class="mi">8</span>
 <span class="nb">max</span> <span class="n">osd</span><span class="mf">.0</span> <span class="mi">8</span>
<span class="n">size</span> <span class="mi">0</span>  <span class="mi">0</span>
<span class="n">size</span> <span class="mi">1</span>  <span class="mi">0</span>
<span class="n">size</span> <span class="mi">2</span>  <span class="mi">0</span>
<span class="n">size</span> <span class="mi">3</span>  <span class="mi">8</span>
</pre></div>
</div>
<dl class="simple">
<dt>在上面的输出结果中，</dt><dd><ol class="arabic simple">
<li><p>存储池 1 有 8 个归置组，及后面的两张表：</p></li>
<li><p>一张表是归置组。每行表示一个归置组，列分别是：</p>
<ul class="simple">
<li><p>归置组 id ，</p></li>
<li><p>acting set ，和</p></li>
<li><p>主 OSD 。</p></li>
</ul>
</li>
<li><p>一张表是所有的 OSD 。每行表示一个 OSD ，列分别是：</p>
<ul class="simple">
<li><p>映射到此 OSD 的归置组数量，</p></li>
<li><p>此 OSD 是它所属 acting set 的第一个，这样的归置组数量，</p></li>
<li><p>此 OSD 是归置组的主 OSD ，这样的归置组数量，</p></li>
<li><p>此 OSD 的 CRUSH 权重，还有</p></li>
<li><p>此 OSD 的权重。</p></li>
</ul>
</li>
<li><p>再看是托管着归置组的 OSD 数量，是 3 个。接下来是</p>
<ul class="simple">
<li><p>avarge, stddev （标准偏差）, stddev/average, expected stddev, expected stddev / average</p></li>
<li><p>min 和 max</p></li>
</ul>
</li>
<li><p>映射到 n 个 OSD 的归置组数量。在本例中，全部的 8 个归置组都映射到了 3 个不同的 OSD 。</p></li>
</ol>
</dd>
</dl>
<p>在一个均衡得不太好的集群中，我们也许会看到类似如下的归置组分布统计，其标准偏差是 1.41421 :</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#osd    count   first   primary c wt    wt</span>
<span class="n">osd</span><span class="mf">.0</span>   <span class="mi">8</span>       <span class="mi">5</span>       <span class="mi">5</span>       <span class="mi">1</span>       <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.1</span>   <span class="mi">8</span>       <span class="mi">1</span>       <span class="mi">1</span>       <span class="mi">1</span>       <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.2</span>   <span class="mi">8</span>       <span class="mi">2</span>       <span class="mi">2</span>       <span class="mi">1</span>       <span class="mi">1</span>

<span class="c1">#osd    count   first    primary c wt    wt</span>
<span class="n">osd</span><span class="mf">.0</span>   <span class="mi">33</span>      <span class="mi">9</span>        <span class="mi">9</span>       <span class="mf">0.0145874</span>     <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.1</span>   <span class="mi">34</span>      <span class="mi">14</span>       <span class="mi">14</span>      <span class="mf">0.0145874</span>     <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.2</span>   <span class="mi">31</span>      <span class="mi">7</span>        <span class="mi">7</span>       <span class="mf">0.0145874</span>     <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.3</span>   <span class="mi">31</span>      <span class="mi">13</span>       <span class="mi">13</span>      <span class="mf">0.0145874</span>     <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.4</span>   <span class="mi">30</span>      <span class="mi">14</span>       <span class="mi">14</span>      <span class="mf">0.0145874</span>     <span class="mi">1</span>
<span class="n">osd</span><span class="mf">.5</span>   <span class="mi">33</span>      <span class="mi">7</span>        <span class="mi">7</span>       <span class="mf">0.0145874</span>     <span class="mi">1</span>
 <span class="ow">in</span> <span class="mi">6</span>
 <span class="n">avg</span> <span class="mi">32</span> <span class="n">stddev</span> <span class="mf">1.41421</span> <span class="p">(</span><span class="mf">0.0441942</span><span class="n">x</span><span class="p">)</span> <span class="p">(</span><span class="n">expected</span> <span class="mf">5.16398</span> <span class="mf">0.161374</span><span class="n">x</span><span class="p">))</span>
 <span class="nb">min</span> <span class="n">osd</span><span class="mf">.4</span> <span class="mi">30</span>
 <span class="nb">max</span> <span class="n">osd</span><span class="mf">.1</span> <span class="mi">34</span>
<span class="n">size</span> <span class="mi">00</span>
<span class="n">size</span> <span class="mi">10</span>
<span class="n">size</span> <span class="mi">20</span>
<span class="n">size</span> <span class="mi">364</span>
</pre></div>
</div>
<p>模拟 upmap 模式下的动态均衡器：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">osdmaptool</span> <span class="o">--</span><span class="n">upmap</span> <span class="n">upmaps</span><span class="o">.</span><span class="n">out</span> <span class="o">--</span><span class="n">upmap</span><span class="o">-</span><span class="n">active</span> <span class="o">--</span><span class="n">upmap</span><span class="o">-</span><span class="n">deviation</span> <span class="mi">6</span> <span class="o">--</span><span class="n">upmap</span><span class="o">-</span><span class="nb">max</span> <span class="mi">11</span> <span class="n">osdmap</span>

<span class="n">osdmaptool</span><span class="p">:</span> <span class="n">osdmap</span> <span class="n">file</span> <span class="s1">&#39;osdmap&#39;</span>
<span class="n">writing</span> <span class="n">upmap</span> <span class="n">command</span> <span class="n">output</span> <span class="n">to</span><span class="p">:</span> <span class="n">upmaps</span><span class="o">.</span><span class="n">out</span>
<span class="n">checking</span> <span class="k">for</span> <span class="n">upmap</span> <span class="n">cleanups</span>
<span class="n">upmap</span><span class="p">,</span> <span class="nb">max</span><span class="o">-</span><span class="n">count</span> <span class="mi">11</span><span class="p">,</span> <span class="nb">max</span> <span class="n">deviation</span> <span class="mi">6</span>
<span class="n">pools</span> <span class="n">movies</span> <span class="n">photos</span> <span class="n">metadata</span> <span class="n">data</span>
<span class="n">prepared</span> <span class="mi">11</span><span class="o">/</span><span class="mi">11</span> <span class="n">changes</span>
<span class="n">Time</span> <span class="n">elapsed</span> <span class="mf">0.00310404</span> <span class="n">secs</span>
<span class="n">pools</span> <span class="n">movies</span> <span class="n">photos</span> <span class="n">metadata</span> <span class="n">data</span>
<span class="n">prepared</span> <span class="mi">11</span><span class="o">/</span><span class="mi">11</span> <span class="n">changes</span>
<span class="n">Time</span> <span class="n">elapsed</span> <span class="mf">0.00283402</span> <span class="n">secs</span>
<span class="n">pools</span> <span class="n">data</span> <span class="n">metadata</span> <span class="n">movies</span> <span class="n">photos</span>
<span class="n">prepared</span> <span class="mi">11</span><span class="o">/</span><span class="mi">11</span> <span class="n">changes</span>
<span class="n">Time</span> <span class="n">elapsed</span> <span class="mf">0.003122</span> <span class="n">secs</span>
<span class="n">pools</span> <span class="n">photos</span> <span class="n">metadata</span> <span class="n">data</span> <span class="n">movies</span>
<span class="n">prepared</span> <span class="mi">11</span><span class="o">/</span><span class="mi">11</span> <span class="n">changes</span>
<span class="n">Time</span> <span class="n">elapsed</span> <span class="mf">0.00324372</span> <span class="n">secs</span>
<span class="n">pools</span> <span class="n">movies</span> <span class="n">metadata</span> <span class="n">data</span> <span class="n">photos</span>
<span class="n">prepared</span> <span class="mi">1</span><span class="o">/</span><span class="mi">11</span> <span class="n">changes</span>
<span class="n">Time</span> <span class="n">elapsed</span> <span class="mf">0.00222609</span> <span class="n">secs</span>
<span class="n">pools</span> <span class="n">data</span> <span class="n">movies</span> <span class="n">photos</span> <span class="n">metadata</span>
<span class="n">prepared</span> <span class="mi">0</span><span class="o">/</span><span class="mi">11</span> <span class="n">changes</span>
<span class="n">Time</span> <span class="n">elapsed</span> <span class="mf">0.00209916</span> <span class="n">secs</span>
<span class="n">Unable</span> <span class="n">to</span> <span class="n">find</span> <span class="n">further</span> <span class="n">optimization</span><span class="p">,</span> <span class="ow">or</span> <span class="n">distribution</span> <span class="ow">is</span> <span class="n">already</span> <span class="n">perfect</span>
<span class="n">osd</span><span class="mf">.0</span> <span class="n">pgs</span> <span class="mi">41</span>
<span class="n">osd</span><span class="mf">.1</span> <span class="n">pgs</span> <span class="mi">42</span>
<span class="n">osd</span><span class="mf">.2</span> <span class="n">pgs</span> <span class="mi">42</span>
<span class="n">osd</span><span class="mf">.3</span> <span class="n">pgs</span> <span class="mi">41</span>
<span class="n">osd</span><span class="mf">.4</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.5</span> <span class="n">pgs</span> <span class="mi">39</span>
<span class="n">osd</span><span class="mf">.6</span> <span class="n">pgs</span> <span class="mi">39</span>
<span class="n">osd</span><span class="mf">.7</span> <span class="n">pgs</span> <span class="mi">43</span>
<span class="n">osd</span><span class="mf">.8</span> <span class="n">pgs</span> <span class="mi">41</span>
<span class="n">osd</span><span class="mf">.9</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.10</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.11</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.12</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.13</span> <span class="n">pgs</span> <span class="mi">41</span>
<span class="n">osd</span><span class="mf">.14</span> <span class="n">pgs</span> <span class="mi">40</span>
<span class="n">osd</span><span class="mf">.15</span> <span class="n">pgs</span> <span class="mi">40</span>
<span class="n">osd</span><span class="mf">.16</span> <span class="n">pgs</span> <span class="mi">39</span>
<span class="n">osd</span><span class="mf">.17</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.18</span> <span class="n">pgs</span> <span class="mi">46</span>
<span class="n">osd</span><span class="mf">.19</span> <span class="n">pgs</span> <span class="mi">39</span>
<span class="n">osd</span><span class="mf">.20</span> <span class="n">pgs</span> <span class="mi">42</span>
<span class="n">Total</span> <span class="n">time</span> <span class="n">elapsed</span> <span class="mf">0.0167765</span> <span class="n">secs</span><span class="p">,</span> <span class="mi">5</span> <span class="n">rounds</span>
</pre></div>
</div>
</div>
<div class="section" id="id5">
<h2>使用范围<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
<p><strong>osdmaptool</strong> 是 Ceph 的一部分，这是个伸缩力强、开源、
分布式的存储系统，更多信息参见 <a class="reference external" href="https://docs.ceph.com">https://docs.ceph.com</a> 。</p>
</div>
<div class="section" id="id6">
<h2>参考<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="../ceph/"><span class="doc">ceph</span></a>(8),
<a class="reference internal" href="../crushtool/"><span class="doc">crushtool</span></a>(8),</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../rados/" class="btn btn-neutral float-right" title="rados – rados 对象存储工具" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../monmaptool/" class="btn btn-neutral float-left" title="monmaptool – ceph 监视器运行图操作工具" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>